<!DOCTYPE HTML>
<html>
<head>
<title>Null frame access tests</title>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
</head>
<body>
<iframe></iframe/>
<script>
window[0].test = 'abc';
window[0][20] = 123;
var childWindow = window[0];
window[0].frameElement.remove();
test(function() {
  // Removing the owner element from the DOM should null the frame. In Blink,
  // this can be observed by checking childWindow.parent == null.
  assert_equals(childWindow.parent, null);
  assert_equals(childWindow.test, 'abc');
}, 'Named property access on detached Window');
test(function() {
  // Removing the owner element from the DOM should null the frame. In Blink,
  // this can be observed by checking childWindow.parent == null.
  assert_equals(childWindow.parent, null);
  assert_equals(childWindow[20], '123', 'Indexed property should still be accessible.');
}, 'Indexed property access on detached Window');
test(function() {
  // Removing the owner element from the DOM should null the frame. In Blink,
  // this can be observed by checking childWindow.parent == null.
  assert_equals(childWindow.parent, null);
  // TODO(dcheng): Why does this return null?
  assert_equals(childWindow.Comment, undefined, 'Interface Object should be gone.');
}, 'Interface Object access on detached Window');
</script>
</body>
</html>
